<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Axios 测试2</title>
		<script src="../js/axios.js"></script>
	</head>
	<body>
		<h1>测试案例2</h1>
	</body>
	<script>
	/*
		1.参数 axios.post(url,数据)
		2.与 axios.get(url.{params:对象}) 写法不太一样
	*/
		let user1 = {id:20,name:"猫",sex:"女"}
		let url1 = "http://localhost:8080/axios/saveUser"
		axios.post(url1,user1).then(function(promise){
			console.log(promise.data);
		})
		/**
		 * 完成用户的修改请求
		 */
		let url2 = "http://localhost:8080/axios/updateUser" 
		let user2 = {id:100,name:"张三",age:18,sex:"女"}
		axios.put(url2,user2).then((promise) => {
			console.log(promise.data);
		})
	</script>
</html>
